package com.micropayhelp.wx.adapter;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.micropayhelp.wx.R;

public class PayHelpBaseAdapter extends BaseAdapter {

	private String[] contents = new String[]{
			"haha!!!"
	};
	private int[] imageViewIds = new int[]{
			R.drawable.ic_launcher
	};
	private LayoutInflater layoutInflater;
	
	Activity activity;

	public PayHelpBaseAdapter(Activity activity) {
		this.activity = activity;
		layoutInflater = LayoutInflater.from(activity.getApplicationContext());
	}
	
	@Override
	public int getCount() {
		return contents.length;
	}

	@Override
	public Object getItem(int position) {
		return contents[position];
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	class ViewHolder {
		TextView textView1;
		ImageView imageView1;
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup arg2) {
		ViewHolder viewHolder = null;
		if (convertView == null) {
			convertView = layoutInflater.inflate(R.layout.pay_help_item, null);
			viewHolder = new ViewHolder();
			viewHolder.textView1 = (TextView) convertView.findViewById(R.id.textView1);
			viewHolder.imageView1 = (ImageView) convertView.findViewById(R.id.imageView1);
			convertView.setTag(viewHolder);
		}else {
			viewHolder = (ViewHolder) convertView.getTag();
			
		}

		viewHolder.textView1.setText(contents[position]);
		viewHolder.imageView1.setImageResource(imageViewIds[position]);
		convertView.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
			}

		});
		return convertView;
	}

}
